package com.weihui.jxc.view;

import java.awt.EventQueue;
import java.awt.Toolkit;

import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import com.weihui.jxc.common.ValidationManager;
import com.weihui.jxc.view.customer.CustomerEditPanel;
import com.weihui.jxc.view.customer.CustormerAddPanel;
import com.weihui.jxc.view.provider.ProviderAddPanel;
import com.weihui.jxc.view.provider.ProviderEditPanel;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.FlowLayout;
/**
 * 供应商信息管理界面（添加、修改、删除）
 * @author xiaowei
 *
 */
public class ProviderInternalFrame extends JInternalFrame {

	/**
	 * 初始化视图
	 */
	public ProviderInternalFrame() {
		setTitle("供应商信息管理");
		setIconifiable(true);//支持窗口最小化显示
		setClosable(true);//支持窗口可关闭
		getContentPane().setLayout(new BorderLayout(0, 0));
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		setBounds(screenSize.width/12,screenSize.height/20,screenSize.width/2,screenSize.height/2);
        //创建选项卡
		JTabbedPane tabPane = new JTabbedPane();
		final ProviderAddPanel addPanel = new ProviderAddPanel();//供应商信息添加面板
		final ProviderEditPanel editPanel = new ProviderEditPanel();//供应商信息编辑面板
		//向选项卡添加面板
		tabPane.addTab("供应商信息添加",null,addPanel,"供应商信息添加");
	//	addPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		tabPane.addTab("供应商信息编辑", null,editPanel,"供应商信息编辑");
		//向Frame窗口添加选项卡
		getContentPane().add(tabPane);
		//给选项卡设置改变监听
		tabPane.addChangeListener(new ChangeListener() {
			
			@Override
			public void stateChanged(ChangeEvent e) {
			    //初始化 编辑界面的下拉列表框
				editPanel.initComboBox();
			}
		});
		//pack();//通过内部组件自动设置窗口大小
		setVisible(true);//显示窗口
	}


}